<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

namespace App\Model;

use L1n6yun\HyperfJwt\Contracts\JwtSubjectInterface;

use function L1n6yun\HyperfJwt\auth;

// 模型实现了 JwtSubjectInterface 接口
class UserModel extends Model implements JwtSubjectInterface
{
    public function getJwtIdentifier():string
    {
        return (string)$this->id;
    }

    public static function retrieveById($id):JwtSubjectInterface
    {
        return self::findFromCache($id);
    }

    public function getUserRow():array
    {
        return $this->toArray();
    }
}
